var a = getApp();

Page({
    data: {
        radio: "1",
        pwd: "",
        account: "",
        number: "",
        password_flag: !0,
        password_show: !1,
        balance: {},
        integral: {},
        point: {},
        is_has: !1
    },
    account_input: function(a) {
        this.setData({
            account: a.detail.value
        });
    },
    onClickHide: function() {
        this.setData({
            password_show: !1
        });
    },
    number_input: function(a) {
        this.setData({
            number: a.detail.value
        });
    },
    input: function(a) {
        this.setData({
            pwd: a.detail.value
        });
    },
    toggle_handle: function(a) {
        "show" == a.currentTarget.dataset.type ? this.setData({
            password_flag: !0
        }) : this.setData({
            password_flag: !1
        });
    },
    password_handle: function(a) {
        "forget" == a.currentTarget.dataset.type ? this.data.is_has ? wx.navigateTo({
            url: "/packageA/member/balance_password/balance_password"
        }) : wx.navigateTo({
            url: "/packageA/member/set_balance_password/set_balance_password"
        }) : this.setData({
            password_show: !1
        });
    },
    _getBalancePwdInfo: function() {
        var t = this, s = a.getNetAddresss("member.balance-password.is-has-password");
        a._getNetWork({
            url: s,
            success: function(a) {
                var s = a.data;
                1 == s.result ? t.setData({
                    is_has: s.data.is_has
                }) : console.log(s.msg);
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    confirm: function() {
        var t = this;
        if ("1" == this.data.radio) {
            if (this.data.number > this.data.balance.value) return a.tips("转让".concat(this.data.balance.name, "不能大于您的").concat(this.data.balance.name));
        } else if ("2" == this.data.radio) {
            if (this.data.number > this.data.point.value) return a.tips("转让".concat(this.data.point.name, "不能大于您的").concat(this.data.point.name));
        } else if ("3" == this.data.radio && this.data.number > this.data.integral.value) return a.tips("转让".concat(this.data.integral.name, "不能大于您的").concat(this.data.integral.name));
        a._postNetWork({
            url: a.getNetAddresss('"plugin.sign-buy.frontend.password-verify.index'),
            data: {
                pwd: this.data.pwd
            },
            success: function(a) {
                if (0 == a.data.result) return t.setData({
                    password_show: !0
                });
                t.sign_buy();
            }
        });
    },
    sign_buy: function() {
        var t = this, s = "", n = {};
        "1" == this.data.radio ? (s = "finance.balance.transfer", n.transfer_money = this.data.number, 
        n.recipient = this.data.account) : "2" == this.data.radio ? (s = "finance.point-transfer.index", 
        n.transfer_point = this.data.number, n.recipient = this.data.account) : (s = "plugin.integral.Frontend.Modules.Integral.Controllers.Transfer", 
        n.change_value = this.data.number, n.recipient_id = this.data.account), a._postNetWork({
            url: a.getNetAddresss(s),
            data: n,
            success: function(s) {
                var n = s.data, e = n.result, i = n.msg;
                if (0 == e) return a.tips(i);
                t.getData(), a.tips(i);
            }
        });
    },
    onChange: function(a) {
        this.setData({
            radio: a.detail
        });
    },
    link: function() {
        wx.navigateTo({
            url: "/packageF/sign_in_subscribe/code/code?type=1"
        });
    },
    password_switch: function() {
        "password" == this.password_flag ? this.password_flag = "text" : this.password_flag = "password";
    },
    onLoad: function() {
        this.getData(), this._getBalancePwdInfo();
    },
    getData: function() {
        var t = this;
        a._getNetWork({
            url: a.getNetAddresss("plugin.sign-buy.frontend.asset-transfer.index"),
            success: function(s) {
                var n = s.data, e = n.result, i = n.msg, o = n.data;
                if (0 == e) return a.tips(i);
                t.setData({
                    balance: o.balance,
                    integral: o.integral,
                    point: o.point
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {
        this.setData({
            pwd: "",
            account: "",
            number: "",
            password_flag: !0,
            password_show: !1
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});